package pers.kuroko.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import pers.kuroko.entity.Register;
import pers.kuroko.service.RegisterService;

import java.util.Map;

@Controller//注解，表明是Controller
@RequestMapping("registerController")
public class RegisterController {
    @Autowired
    @Qualifier("registerService")
    RegisterService registerService;
    @RequestMapping(value = "homePage")
    public String homePage(Register register, Map<String, Object> map) {
       int i = registerService.doRegister(register);
       System.out.print(i);
       if(i>0){
           map.put("register",register);
           System.out.print("注册成功！");
           return "redirect:/";
       }else{
           return "error";
       }
    }
}
